summaryrefslogtreecommitdiffstats
path: root/src/audio_core/opus/decoder_manager.h
blob: 8f6876d5c51e4ae4c863c147830158d85d7894f3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later

#pragma once

#include "audio_core/opus/hardware_opus.h"
#include "audio_core/opus/parameters.h"
#include "common/common_types.h"
#include "core/hle/service/audio/errors.h"

namespace Core {
class System;
}

namespace AudioCore::OpusDecoder {

class OpusDecoderManager {
public:
    OpusDecoderManager(Core::System& system);

    HardwareOpus& GetHardwareOpus() {
        return hardware_opus;
    }

    Result GetWorkBufferSize(const OpusParameters& params, u32& out_size);
    Result GetWorkBufferSizeEx(const OpusParametersEx& params, u32& out_size);
    Result GetWorkBufferSizeExEx(const OpusParametersEx& params, u32& out_size);
    Result GetWorkBufferSizeForMultiStream(const OpusMultiStreamParameters& params, u32& out_size);
    Result GetWorkBufferSizeForMultiStreamEx(const OpusMultiStreamParametersEx& params,
                                             u32& out_size);
    Result GetWorkBufferSizeForMultiStreamExEx(const OpusMultiStreamParametersEx& params,
                                               u32& out_size);

private:
    Core::System& system;
    HardwareOpus hardware_opus;
    std::array<u32, MaxChannels> required_workbuffer_sizes{};
};

} // namespace AudioCore::OpusDecoder